import request from '@/utils/request'

export default {
  getPlayList(params) {
    return request({
      url: '/plays',
      method: 'get',
      params
    })
  },
  getPlayById(id) {
    return request({
      url: '/plays/' + id,
      method: 'get'
    })
  },
  batchDelete(ids) {
    return request({
      url: '/plays/',
      method: 'delete',
      params: {
        ids: ids
      }
    })
  },
  addPlay(data) {
    return request({
      url: '/plays',
      method: 'post',
      data
    })
  },
  editActor(data) {
    return request({
      url: '/plays/' + data.id,
      method: 'put',
      data
    })
  },
  getActorType() {
    return request({
      url: '/actor-type',
      method: 'get'
    })
  },
  queryActorByNodeId(data) {
    return request({
      url: '/actors/node',
      method: 'get',
      params: data
    })
  },
  querySectionByNodeId(data) {
    return request({
      url: '/plays/nodes',
      method: 'get',
      params: data
    })
  },
  saveProgramByNodeId(data) {
    return request({
      url: '/plays/nodes',
      method: 'post',
      data
    })
  },
  deleteProgram(ids) {
    return request({
      url: '/program',
      method: 'delete',
      params: ids
    })
  },

  deleteSections(data) {
    return request({
      url: '/sections',
      method: 'delete',
      data
    })
  },
  getSectionDetail(id) {
    return request({
      url: '/sections/' + id,
      method: 'get'
    })
  },
  updateSection(data) {
    return request({
      url: '/sections/' + data.id,
      method: 'put',
      data
    })
  },

  queryProgramBySectionId(data) {
    return request({
      url: '/program',
      method: 'get',
      params: data
    })
  },
  saveProgramBySectionId(data) {
    return request({
      url: '/program',
      method: 'post',
      data
    })
  },
  getProgramDetail(id) {
    return request({
      url: '/program/' + id,
      method: 'get'
    })
  },
  updateProgram(data) {
    return request({
      url: '/program/' + data.id,
      method: 'put',
      data
    })
  },

  queryPartByNodeId(data) {
    return request({
      url: '/program/part',
      method: 'get',
      params: data
    })
  },
  savePartByProgramId(data) {
    return request({
      url: '/program/part',
      method: 'post',
      data
    })
  },
  deletePart(ids) {
    return request({
      url: '/program/part',
      method: 'delete',
      params: ids
    })
  },
  updatePart(data) {
    return request({
      url: '/program/part',
      method: 'put',
      data
    })
  },

  getUploadToken(data) {
    return ({
      url: '/sts/token',
      method: 'get',
      params: data
    })
  }
}
